home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Today (Latin America) Volume 1 #6 / CD-ROM Today 6 Latam.iso / referenc / evol / articles.cxt / 00187_Monkies on typewriters.txt < prev    next >
Encoding:
Text File  |  1996-11-08  |  2.8 KB  |  27 lines

  1.  
  2.  
  3. I don't know who it was first pointed out that, given enough time, a monkey bashing away at random on a typewriter could produce all the works of Shakespeare. The operative phrase is, of course, given enough time. Let us limit the task facing our monkey somewhat. Suppose that he has to produce, not the complete works of Shakespeare but just the short sentence 'Methinks it is like a weasel', and we shall make it relatively easy by giving him a typewriter with a restricted keyboard, one with just the 26 (capital) letters, and a space bar. How long will he take to write this one little sentence?  
  4.  
  5. The sentence has 28 characters in it, so let us assume that the monkey has a series of discrete 'tries', each consisting of 28 bashes at the keyboard. If he types the phrase correctly, that is the end of the experiment. If not, we allow him another 'try' of 28 characters. I don't know any monkeys, but fortunately my l l-month old daughter is an experienced randomizing device, and she proved only too eager to step into the role of monkey typist. Here is what she typed on the computer:  
  6.  
  7. UMMK JK CDZZ F ZD DSDSKSM
  8. S SS FMCV PU I DDRGLKDXRRDO
  9. RDTE QDWFDVIOY UDSKZWDCCVYT
  10. H CHVY NMGNBAYTDFCCVD D
  11. RCDFYYYRM N DFSKD LD K WDWK
  12. JJKAUIZMZI UXDKIDISFUMDKUDXI  
  13.  
  14. She has other important calls on her time, so I was obliged to program the computer to simulate a randomly typing baby or monkey:  
  15.  
  16. WDLDMNLT DTJBKWIRZREZLMQCO P
  17. Y YVMQKZPGJXWVHGLAWFVCHQYOPY
  18. MWR SWTNUXMLCDLEUBXTQHNZVJQF
  19. FU OVAODVYKDGXDEKYVMOGCIS VT
  20. HZQZDSFZIHIVPHZPETPWVOVPMZGF
  21. GEWRGZRPBCTPGQMCKHFDBGW ZCCF
  22.  
  23. And so on and on. It isn't difficult to calculate how long we should reasonably expect to wait for the random computer (or baby or monkey) to type METHINKS IT IS LIKE A WEASEL. Think about the total number of possible phrases of the right length that the monkey or baby or random computer could type. There are 27 possible letters (counting 'space' as one letter) in the first position. The chance of the monkey happening to get the first letter - M - right is therefore 1 in 27. The chance of it getting the first two letters - ME - right is the chance of it getting the second letter - E - right ( 1 in 27) given that it has also got the first letter - M - right, therefore 1/27 x 1/27, which equals 1/729. The chance of it getting the first word - METHINKS - right is 1/27 for each of the 8 letters, therefore (1/27) x (1/27) x (1/27) x (1/27) . . ., etc. 8 times, or (1/27) to the power 8. The chance of it getting the entire phrase of 28 characters right is (1/27) to the power 28, i.e. (1/27) multiplied by itself 28 times. These are very small odds, about 1 in 10,000 million million million million million million. To put it mildly, the phrase we seek would be a long time coming, to say nothing of the complete works of Shakespeare.  
  24.  
  25. **links**
  26. 2 Breeding solutions
  27.